package cn.net.isir.service2;

import cn.net.isir.core.BasicService2;
import cn.net.isir.core.SetBasicDao;
import cn.net.isir.dao.TurnDao;
import cn.net.isir.entity.Order;
import cn.net.isir.entity.TimeRange;
import cn.net.isir.entity.Turn;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Service
public class TurnService2 extends BasicService2<Turn> {
    @SetBasicDao
    @Resource
    private TurnDao turnDao;

    /**
     * 获取每天符合日活的订单数量和金额
     * @param everyOrderFee 每天的日活额度(查询系数表获取)
     * @param shopId 店铺id
     * @param timeRangeList 销售人员有效时间段列表
     * @return
     */
    public List<Map<String, Object>> getLastMonthShopTurnInfoByShopId(BigDecimal everyOrderFee, String shopId, List<TimeRange> timeRangeList) {
        return turnDao.getLastMonthShopTurnInfoByShopId(everyOrderFee, shopId, timeRangeList);
    }

    /**
     * 获取上个月本店铺的所有订单
     *
     * @param shopId 店铺id
     * @return 订单列表(最多20条, 因为日活标准是20条)
     */
    public List<Order> getLastMonthTotalFlowByShopId(String shopId, List<TimeRange> timeRangeList) {
        return turnDao.getLastMonthTotalFlowByShopId(shopId, timeRangeList);
    }
}
